<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    /**
     * arr.splice(删除数组元素的索引位置，被删除元素的个数,新添加的元素)
     * 从指定的索引位置删除指定个数的数组元素arr.splice(index,num);
     * 在特定的索引位置添加新元素arr.splice(index,0,新元素);
     * 前两个参数是必须参数，后面参数可选
    */
    var userlist = ["zhangsan","lisi","wangwu","oubohan","zhaoliu"];
    var index = userlist.indexOf("oubohan");
    //返回值为删掉的数组元素，返回一个新的数组
    //var result = userlist.splice(index,1);
    console.log(result);
    userlist.splice(1,0,"lisang","zhangsi");
    console.log(userlist);

</script>
</html>